//
//  ClassForCollectionViewCell.m
//  AmountBody
//
//  Created by smm on 2017/12/9.
//  Copyright © 2017年 RCMTM. All rights reserved.
//

#import "ClassForCollectionViewCell.h"
#define itemWidth (SCREEN_W-60)/5.0
#define itemHeight itemWidth/(100/120.0)+75
@implementation ClassForCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.headImage = [[UIImageView alloc] init];
        self.headImage.frame = CGRectMake(0, 0, itemWidth, itemHeight-65);
        self.headImage.contentMode = UIViewContentModeScaleAspectFit;
        [self.contentView addSubview:self.headImage];
        self.nameLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.nameLabel];
    }
    return self;
}
-(void)setCellWithModel:( ClassModel*)model
{
    _headImage.frame = CGRectMake(0, 10, itemWidth, itemHeight-65);
    [_headImage sd_setImageWithURL:[NSURL URLWithString:model.imageUrl] placeholderImage:[UIImage imageNamed:model.imageUrl]];
    _nameLabel.text = model.name;
    _nameLabel.textColor = ShenZi_Color;
    _nameLabel.font = Cell_Big_Font;
    _nameLabel.numberOfLines = 2;
    [_nameLabel sizeToFit];
    _nameLabel.frame = CGRectMake((itemWidth-_nameLabel.frame.size.width)/2.0,_headImage.frame.origin.y+_headImage.frame.size.height+10, _nameLabel.frame.size.width, 35);
    
}
@end
